﻿namespace PMS.Client.FrmOrgan
{
    using PMS.BLL;
    using PMS.Model;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class FrmUpdateFunctions : Form
    {
        private OrganBLL bll = new OrganBLL();
        private Button btnCancel;
        private Button btnSave;
        private IContainer components = null;
        private TextBox Functions;
        private Label label1;
        private Label label2;
        private Label label3;
        private Label lbTitle;
        private int organID = 0;
        private DateTimePicker PermitDate;
        private TextBox PermitNo;

        public FrmUpdateFunctions(int organID)
        {
            this.InitializeComponent();
            this.organID = organID;
            Organ model = this.bll.GetModel(organID);
            this.lbTitle.Text = model.OrganName + " " + this.lbTitle.Text;
            this.PermitNo.Text = model.PermitNo;
            this.PermitDate.Value = model.PermitDate.Value;
            this.Functions.Text = model.Functions;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.bll.UpdateFunctions(this.organID, this.PermitNo.Text, this.Functions.Text))
            {
                base.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("修改失败！");
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.Functions = new TextBox();
            this.label2 = new Label();
            this.PermitNo = new TextBox();
            this.label1 = new Label();
            this.lbTitle = new Label();
            this.btnCancel = new Button();
            this.btnSave = new Button();
            this.PermitDate = new DateTimePicker();
            this.label3 = new Label();
            base.SuspendLayout();
            this.Functions.BackColor = Color.FromArgb(0xd9, 0xea, 0xf7);
            this.Functions.BorderStyle = BorderStyle.FixedSingle;
            this.Functions.Location = new Point(0x76, 0x6d);
            this.Functions.Multiline = true;
            this.Functions.Name = "Functions";
            this.Functions.Size = new Size(0x134, 0x74);
            this.Functions.TabIndex = 0x17;
            this.label2.AutoSize = true;
            this.label2.Location = new Point(0x3b, 0x6f);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x35, 12);
            this.label2.TabIndex = 0x16;
            this.label2.Text = "职能描述";
            this.PermitNo.BackColor = Color.FromArgb(0xd9, 0xea, 0xf7);
            this.PermitNo.BorderStyle = BorderStyle.FixedSingle;
            this.PermitNo.Location = new Point(0x76, 0x31);
            this.PermitNo.Name = "PermitNo";
            this.PermitNo.Size = new Size(0x134, 0x15);
            this.PermitNo.TabIndex = 0x15;
            this.label1.AutoSize = true;
            this.label1.Location = new Point(11, 0x34);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x65, 12);
            this.label1.TabIndex = 20;
            this.label1.Text = "机构职能批准文号";
            this.lbTitle.BackColor = Color.Gold;
            this.lbTitle.Dock = DockStyle.Top;
            this.lbTitle.Font = new Font("宋体", 14.25f, FontStyle.Bold, GraphicsUnit.Point, 0x86);
            this.lbTitle.ForeColor = Color.Black;
            this.lbTitle.Location = new Point(0, 0);
            this.lbTitle.Name = "lbTitle";
            this.lbTitle.Size = new Size(0x1f9, 0x1f);
            this.lbTitle.TabIndex = 0x13;
            this.lbTitle.Text = "机构职能";
            this.lbTitle.TextAlign = ContentAlignment.MiddleCenter;
            this.btnCancel.BackColor = Color.White;
            this.btnCancel.FlatStyle = FlatStyle.Popup;
            this.btnCancel.Location = new Point(300, 0xfb);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new Size(0x4b, 0x17);
            this.btnCancel.TabIndex = 0x19;
            this.btnCancel.Text = "取消";
            this.btnCancel.UseVisualStyleBackColor = false;
            this.btnCancel.Click += new EventHandler(this.btnCancel_Click);
            this.btnSave.BackColor = Color.White;
            this.btnSave.FlatStyle = FlatStyle.Popup;
            this.btnSave.Location = new Point(0x76, 0xfb);
            this.btnSave.Name = "btnSave";
            this.btnSave.Size = new Size(0x4b, 0x17);
            this.btnSave.TabIndex = 0x18;
            this.btnSave.Text = "保存";
            this.btnSave.UseVisualStyleBackColor = false;
            this.btnSave.Click += new EventHandler(this.btnSave_Click);
            this.PermitDate.Location = new Point(0x76, 0x4e);
            this.PermitDate.Name = "PermitDate";
            this.PermitDate.Size = new Size(0x134, 0x15);
            this.PermitDate.TabIndex = 0x1b;
            this.label3.AutoSize = true;
            this.label3.Location = new Point(0x3b, 0x53);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x35, 12);
            this.label3.TabIndex = 0x1a;
            this.label3.Text = "下文时间";
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            this.BackColor = Color.FromArgb(0xa4, 0xc4, 0xeb);
            base.ClientSize = new Size(0x1f9, 320);
            base.Controls.Add(this.PermitDate);
            base.Controls.Add(this.label3);
            base.Controls.Add(this.btnCancel);
            base.Controls.Add(this.btnSave);
            base.Controls.Add(this.Functions);
            base.Controls.Add(this.label2);
            base.Controls.Add(this.PermitNo);
            base.Controls.Add(this.label1);
            base.Controls.Add(this.lbTitle);
            base.FormBorderStyle = FormBorderStyle.FixedSingle;
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "FrmUpdateFunctions";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "修改机构职能";
            base.ResumeLayout(false);
            base.PerformLayout();
        }
    }
}

